# -*- coding: utf-8 -*-
import maya.cmds as mc  
import maya.mel as mel
import os
import sys
#from Check_List import * #集体导入文件检查项
def QL_batch_Check():
	import importlib
	import codecs
	py_path = "H:\QL_tool_file\Window_Tool\LogicalFile\Batch_Submission\CheckType"
	folder_path = "H:/QL_tool_file/Window_Tool/LogicalFile/Batch_Submission/CheckName.txt"
	sys.path.append(py_path)
	log = ''
	log_str=''
	all_py = os.listdir( py_path)

	with codecs.open(folder_path, 'r', encoding='utf-8') as f:
		ui_array = f.read().split("\n")
		for ui_string in ui_array:
			ui_components = ui_string.split(",,,")
			_class = ui_components[0].strip()
			Check_item = ui_components[1].strip()
			for filename in all_py:
				script_neme = filename.split(".")[0]
				if filename.endswith(".py"):	#判断是否为py文件
					if filename == "__init__.py"and"__init__.pyc":  # 排除__init__
						continue
					else:
						if _class == script_neme:
							module = importlib.import_module(script_neme)
							function =(getattr(module,_class))
							print(function())
							#log_str += Check_item + "\t" + function()+"\n"
	#print(log_str)
	'''
	path = "H:/QL_tool_file/Window_Tool/LogicalFile/Batch_Submission/file/log.txt"
	with open ( path, 'a' ) as f:
		for line in log_str.splitlines ():
			f.write ( line + "\n" )'''
	cmds.file ( f = 1, save = True, typ = 'mayaBinary' )
QL_batch_Check()